/*
 * Copyright 2010 Christoph Widulle (christoph.widulle@googlemail.com)
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */



package org.amarena2d.examples.scenes;

import com.android1.amarena2d.input.LongPressDetector;
import com.android1.amarena2d.nodes.Scene;
import com.android1.amarena2d.nodes.SimpleLabel;
import com.android1.amarena2d.nodes.sprites.SharedSprite;
import com.android1.amarena2d.texture.Textures;
import com.badlogic.gdx.graphics.Color;
import org.amarena2d.examples.Example;

@Example(name = "Long Press", category = "Input")
public class LongPressExampleScene extends Scene {


    public LongPressExampleScene() {

        engine.getRenderer().setClearColor(Color.WHITE);

        touch().makeTouchable(new LongPressDetector() {
            @Override
            public void onLongPress(float x, float y, int pointer) {
                SharedSprite sprite = new SharedSprite(Textures.$("andou_die02.png").get());
                //we have to add it first, otherwise it wouldn't be initialized and size is zero.
                //if you add a new entiy to a node that is running, it will call #enter() (and #init() if not already done)
                add(sprite);
                sprite.setOrigionXY(x,y);
            }
        });

        add(new SimpleLabel("(Make a Long Press to add a new Andou Sprite.)", 20, 20, Color.BLACK));

    }

}